// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import { Button, Row, Col, Search, Swipe, SwipeItem, Lazyload, List, Field, NavBar, Tab, Tabs, PullRefresh, Stepper, Tabbar, TabbarItem, Cell, CellGroup, GoodsAction, GoodsActionBigBtn, GoodsActionMiniBtn, SwipeCell, Card } from 'vant'
import {toMoney} from '@/filter/moneyFilter';
import {toSwString, toSwTime} from '@/filter/stringFilter';
import axios from 'axios';
import '@/router/permission.js'; // 导入登录权限manager
Vue.prototype.$ajax = axios

Vue.use(Button).use(Search)
.use(Row).use(Col)
.use(Swipe).use(SwipeItem).use(Lazyload)
.use(List)
.use(Field).use(NavBar) // 输入框，导航栏
.use(Tab).use(Tabs) // 标签页
.use(PullRefresh) // 下拉刷新
.use(Stepper) // 步进器【购物车的+1，-1】
.use(Tabbar).use(TabbarItem) // 底部标签栏
.use(Cell).use(CellGroup) // Cell单元格
.use(GoodsAction).use(GoodsActionBigBtn).use(GoodsActionMiniBtn) // 购物车组件
.use(SwipeCell) // 滑动单元格
.use(Card) // 商品卡片

Vue.filter('moneyFilter', function (val) {
  return toMoney(val);
});
Vue.filter('stringFilter', function(str, howmany) {
  return toSwString(str, howmany);
});
Vue.filter('timeFilter', function (str, howmany) {
  return toSwTime(str, howmany);
});

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
